<?php
	sleep(1);
	require_once "includes/config.php";	
	$id = $_REQUEST['id'];
	$qry="SELECT * FROM tbl_state where country_id='$id'";
	$res=mysql_query($qry);
		if(mysql_num_rows($res) > 0)
		{
		?>
		<select name="state" id="state" onChange="funSelectCity(this.value,'selectedCity');" style="width:145px;height: 28px;" class="inputbg">
		 <option value="">Select state..</option>	
		<?php				
			while($row = mysql_fetch_assoc($res))
			{
			?>
				<option value="<?php echo $row['stateid'] ?>"><?php echo $row['statename'];?></option>
			<?php		
			}
			?></select><?php
		}
		else {
		?>  <input type="text" name="state" id="state" onFocus="funSelectCity(this.value,'selectedCity');" onChange="funSelectCity(this.value,'selectedCity');"> 
 <?php } ?>